package com.niuwa.p2p.core.pdf;

import com.niuwa.p2p.core.pdf.exception.DocumentGeneratingException;
import com.niuwa.p2p.core.pdf.factory.ConcretePDFFactory;
import com.niuwa.p2p.core.pdf.factory.PDFFactory;

/**
 * html转换成PDF
 * @ClassName: Html2Pdf
 * @Description: html转换成PDF
 * @param template classpath中路径模板路径
 * @param documentVo 模板数据
 * @param outputFile 生成pdf的路径
 * @throws DocumentGeneratingException
 * @author jsj
 */
public class Html2Pdf {

    public static boolean convertHtmlToPdf(String template, DocumentVo documentVo, String outputFile) throws DocumentGeneratingException {
        // 创建PDF具体工厂
    	PDFFactory pdfFactory = ConcretePDFFactory.getInstance();
    	// 创建itext PDF转换实现类
    	PDFProductItext pdfProduct = pdfFactory.createProduct(PDFProductItext.class); 
		// 生成pdf
    	return pdfProduct.generate(template, documentVo, outputFile);
    
    }

}
